package com.shelpe.services.algorithm.ranking;

import java.util.List;

import com.shelpe.services.algorithm.client.RankClient;
import com.shelpe.services.algorithm.controller.RankingController;
import com.shelpe.services.algorithm.entity.batis.Keyword;
import com.shelpe.services.algorithm.entity.jpa.Tactics;
import com.shelpe.services.algorithm.entity.jpa.WantRank;

import lombok.Data;

@Data
public class RankingSustainer {
	
	private Tactics tactics;
	private List<WantRank> wantRanks;
	private List<Keyword> keywords;
	private String nick;
	private long productID;
	private long adgroupID;
	
	private List<RankClient.KeywordRealtimeRankItem> ranks;
	
	private List<RankingController.RankingResult> results;
	
	public Keyword findKeywordByKeywordID(long keywordID){
		if(this.keywords != null){
			for(Keyword kw:this.keywords){
				if(kw.getKeywordId() == keywordID){
					return kw;
				}
			}
		}
		return null;
	}
	
	public RankClient.KeywordRealtimeRankItem findRankByKeywordID(long keywordID){
		if(this.ranks != null){
			for(RankClient.KeywordRealtimeRankItem rank:this.ranks){
				if(rank.getKeywordID() == keywordID){
					return rank;
				}
			}
		}
		return null;
	}
}
